/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package miage.sessions.ecom;

import java.io.Serializable;
import java.rmi.RemoteException;
import javax.ejb.CreateException;
import javax.ejb.EJB;
import javax.ejb.FinderException;
import javax.ejb.Stateless;
import miage.beans.MagasinPresentation;
import miage.beans.ProduitPresentation;
import miage.sessions.ecom.remote.EcomAdminRemote;
import miage.sessions.persistant.AccountProductStoreFacadeLocal;
import miage.sessions.persistant.ProductFacadeLocal;

/**
 *
 * @author Pepito
 */
@Stateless
public class EcomAdmin implements EcomAdminRemote, Serializable {
    @EJB
    private AccountProductStoreFacadeLocal accountProductStoreFacade;
    @EJB
    private ProductFacadeLocal productFacade;
    
    @Override
    public void addProduit(MagasinPresentation magasin, ProduitPresentation produit)throws CreateException, FinderException, RemoteException{
        productFacade.addNewProduit(magasin, produit);
    }

    @Override
    public void updateProduit(ProduitPresentation produit)throws CreateException, FinderException, RemoteException{
        productFacade.updateProduit(produit);
    }

    @Override
    public void deleteProduit(String reference_produit)throws FinderException, RemoteException{
        productFacade.deleteProduit(reference_produit);
    }
    
    @Override
    public void addStore(MagasinPresentation magasin)throws CreateException, FinderException, RemoteException{
        accountProductStoreFacade.addMagasin(magasin);
    }
    
    @Override
    public void updateStore(MagasinPresentation magasin)throws CreateException, FinderException, RemoteException{
        accountProductStoreFacade.updateMagasin(magasin);
    }

    @Override
    public void deleteStore(String reference_store)throws FinderException, RemoteException{
        accountProductStoreFacade.deleteMagasin(reference_store);
    }    
}
